package DailyQuestions;

import java.util.Arrays;

public class Day28_01 {
    public static void main(String[] args) {
        int[] arr={7,7,9,5,1,6,7,9,3,2,6};
        oddInOddEvenInEven(arr);
        System.out.println(Arrays.toString(arr));
    }
    public static void oddInOddEvenInEven(int[] arr) {
        int length=arr.length;
        int odd =1;
        int even=0;
        while(odd<length&&even<length){
            while(odd<length&&arr[odd]%2==1){
                odd+=2;
            }
            while(even<length&&arr[even]%2==0){
                even+=2;
            }
            if(odd<length&&even<length) {
                int temp = arr[odd];
                arr[odd] = arr[even];
                arr[even] = temp;
            }
        }
    }
}
